package selcoursesys.entity;

import javax.persistence.*;
import java.sql.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Lpbdz on 2017/4/8.
 */
@Entity
@Table(name = "teacher", schema = "manage_system", catalog = "")
public class TeacherEntity {
    private String tid;
    private String tname;
    private String tsex;
    private Date tbirth;
    private String tIDnum;
    private String trace;
    private Date tindate;
    private String mail;
    private AcademyEntity academyEntity;
    private AcademyEntity academyByAid;
    private Set course=new HashSet();

    public Set getCourse() {
        return course;
    }

    public void setCourse(Set course) {
        this.course = course;
    }

    public TeacherEntity(String tid, String tname, String tsex, Date tbirth, String tIDnum, String trace, Date tindate, String mail) {
        this.tid = tid;
        this.tname = tname;
        this.tsex = tsex;
        this.tbirth = tbirth;
        this.tIDnum = tIDnum;
        this.trace = trace;
        this.tindate = tindate;
        this.mail = mail;
    }

    public TeacherEntity() {

    }

    public AcademyEntity getAcademyEntity() {
        return academyEntity;
    }

    public void setAcademyEntity(AcademyEntity academyEntity) {
        this.academyEntity = academyEntity;
    }

    public void TeacherEntity(String tid, String tname, String tsex, Date tbirth, String tIDnum, String trace, Date tindate, String mail){

    }

    @Id
    @Column(name = "tid")
    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    @Basic
    @Column(name = "tname")
    public String getTname() {
        return tname;
    }

    public void setTname(String tname) {
        this.tname = tname;
    }

    @Basic
    @Column(name = "tsex")
    public String getTsex() {
        return tsex;
    }

    public void setTsex(String tsex) {
        this.tsex = tsex;
    }

    @Basic
    @Column(name = "tbirth")
    public Date getTbirth() {
        return tbirth;
    }

    public void setTbirth(Date tbirth) {
        this.tbirth = tbirth;
    }

    @Basic
    @Column(name = "tIDnum")
    public String gettIDnum() {
        return tIDnum;
    }

    public void settIDnum(String tIDnum) {
        this.tIDnum = tIDnum;
    }

    @Basic
    @Column(name = "trace")
    public String getTrace() {
        return trace;
    }

    public void setTrace(String trace) {
        this.trace = trace;
    }

    @Basic
    @Column(name = "tindate")
    public Date getTindate() {
        return tindate;
    }

    public void setTindate(Date tindate) {
        this.tindate = tindate;
    }

    @Basic
    @Column(name = "mail")
    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TeacherEntity that = (TeacherEntity) o;

        if (tid != null ? !tid.equals(that.tid) : that.tid != null) return false;
        if (tname != null ? !tname.equals(that.tname) : that.tname != null) return false;
        if (tsex != null ? !tsex.equals(that.tsex) : that.tsex != null) return false;
        if (tbirth != null ? !tbirth.equals(that.tbirth) : that.tbirth != null) return false;
        if (tIDnum != null ? !tIDnum.equals(that.tIDnum) : that.tIDnum != null) return false;
        if (trace != null ? !trace.equals(that.trace) : that.trace != null) return false;
        if (tindate != null ? !tindate.equals(that.tindate) : that.tindate != null) return false;
        if (mail != null ? !mail.equals(that.mail) : that.mail != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = tid != null ? tid.hashCode() : 0;
        result = 31 * result + (tname != null ? tname.hashCode() : 0);
        result = 31 * result + (tsex != null ? tsex.hashCode() : 0);
        result = 31 * result + (tbirth != null ? tbirth.hashCode() : 0);
        result = 31 * result + (tIDnum != null ? tIDnum.hashCode() : 0);
        result = 31 * result + (trace != null ? trace.hashCode() : 0);
        result = 31 * result + (tindate != null ? tindate.hashCode() : 0);
        result = 31 * result + (mail != null ? mail.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "aid", referencedColumnName = "aid", nullable = false)
    public AcademyEntity getAcademyByAid() {
        return academyByAid;
    }

    public void setAcademyByAid(AcademyEntity academyByAid) {
        this.academyByAid = academyByAid;
    }
}
